﻿@model  PagingDataSet<User>
@{    
    var currentUser = UserContext.CurrentUser;
    Dictionary<long, IEnumerable<string>> tagNameDic = ViewData["tagNameDic"] as Dictionary<long, IEnumerable<string>>;
}
 
                              @foreach (var user in Model)
                              {
                                string gender = "";

                                if (user.Profile != null)
                                {
                                    if (user.Profile.Gender == GenderType.Male)
                                    {
                                        gender = "tn-icon tn-smallicon-male";
                                    }
                                    else if (user.Profile.Gender == GenderType.FeMale)
                                    {
                                        gender = "tn-icon tn-smallicon-female";
                                    }
                                }
                                <li class="tn-list-item tn-helper-clearfix tn-border-gray tn-border-bottom tn-border-dashed">
                                  <div class="tn-list-item-area-left">
                                    @Html.ShowUserAvatar(user, AvatarSizeType.Medium, true, HyperLinkTarget._blank)
                                  </div>
                                  <div class="tn-list-item-area-main">
                                    <div class="tn-list-item-row tn-helper-clearfix">
                                    @if (currentUser != null && !currentUser.IsFollowed(user.UserId))
                                      {
                                        <div class="tnc-relationship" id="followedDiv">
                                            @Html.FollowUser(user.UserId,"加收藏",followButtonType:FollowButtonTypes.Link)
                                        </div>
                                      }
                                      <div class="tnc-user-notename"><a href="@SiteUrls.Instance().SpaceHome(user.UserName)" class="tn-user-name" target="_blank">@user.DisplayName</a>
                                      @Html.IdentificationType(user.UserId)
                                       </div>
                                    </div>
                                    <div class="tnc-userinfo-content tn-helper-clearfix">
                                      <div class="tnc-userinfo-item">
                                        <div class="tn-list-item-row">
                                          <div class="tn-location"><span title='@if(user.Profile.Gender == GenderType.Male){<text>男</text>}else{<text>女</text>}'  class="@gender"></span>
                                          @if (user.Profile != null && !string.IsNullOrEmpty(user.Profile.NowAreaCode))
                                          {   
                                               @Formatter.FormatArea(user.Profile.NowAreaCode, false)
                                          }
                                           </div>
                                        </div>
                                        <div class="tn-list-item-row tnc-usernums"> 
                                            <span>收藏 <a href="@SiteUrls.Instance().ListFollowedUsers(user.UserName)" target="_blank"><strong>@user.FollowedCount</strong></a></span> 
                                            <span class="tn-spacer tn-text-note">|</span> <span>粉丝 <a href="@SiteUrls.Instance().ListFollowers(user.UserName)" target="_blank"><strong>@user.FollowerCount</strong></a></span> 
                                            <span class="tn-spacer tn-text-note">|</span> <span>内容数 <strong>@user.ContentCount</strong></span>
                                        </div>
                                      </div>
                                    </div>
                                    <div class="tn-list-item-row">
                                      <div class="tn-widget tn-bubble tn-bubble-arrow-top">
                                        <div class="tn-bubble-arrow"> <b class="tn-arrow-b1 tn-border-gray"></b> <b class="tn-arrow-b2 tn-widget-bubble"></b> </div>
                                        <div class="tn-bubble-content tn-border-gray tn-corner-all">                                            
                                            @{
                                          IEnumerable<string> tags = tagNameDic[user.UserId];
                                          int count = tags.Count();
                                            }
                                            <p>
                                              @count<text>个共用标签：</text>
                                                @foreach (string tag in tags)
                                                {
                                                <a href="@SiteUrls.Instance().UserSearch(tag, UserSearchRange.TAG)" target="_blank">@tag</a>
                                                }
                                            </p>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </li>
                              }
                              @Html.Hidden("pageCount", @Model.PageCount)